# Dockerfile
FROM 192.168.1.220:5000/oraclelinux:6.9

LABEL maintainer="lixl@sysware.com.cn"

# 定义变量
ARG ORACLE_BASE=/u01/app/oracle
ARG ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

RUN rm -f /etc/yum.repos.d/*
ADD ol6.repo /etc/yum.repos.d/
RUN yum -y install oracle-rdbms-server-11gR2-preinstall vim && yum clean all

ADD epel6.repo /etc/yum.repos.d/
RUN yum -y install rlwrap readline readline-devel && yum clean all

#install db
RUN mkdir -p $ORACLE_BASE
#ADD u01/app.tar.gz /u01/
COPY ../database/u01/app/oracle $ORACLE_BASE
COPY oratab /etc/oratab
COPY bash_profile /home/oracle/.bashrc
RUN chown -R oracle:oinstall /u01 && chown oracle:oinstall /etc/oratab \
&& chown oracle:oinstall /home/oracle/.bashrc

#设置OS环境变量
ENV ORACLE_BASE $ORACLE_BASE
ENV ORACLE_HOME $ORACLE_HOME
ENV PATH $ORACLE_HOME/bin:$PATH
ENV ORACLE_SID sysware

USER oracle

EXPOSE 1521/tcp

ENTRYPOINT $ORACLE_HOME/bin/lsnrctl start && $ORACLE_HOME/bin/dbstart && tail -f $ORACLE_HOME/startup.log

# docker build -t oracledb:v1 ./
# docker run -idt -p1521:1521 --name oracledb oracledb:v1
# docker exec -it oracledb /bin/bash
